<html>

<head>
<meta charset="UTF-8">
<title>申请详情</title>
</head>
<body>
	<link rel="stylesheet" type="text/css" href="/css/form.css">
	<script type="text/javascript" src="/js/apply.js"></script>
	<script type="text/javascript">
		$(".navigation span:first").text("审批管理");
	</script>
	<#include "/head.ftl"/>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<a title="返回" class="btn btn-setting" onclick="back(this)">
					<i class="iconfont icon-undo"></i>
				</a> <a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a> 
			</div>
			<div class="apply-info">
				<#if apply??>
					<div class="info-head">
						<table>
							<tr>
								<td style="text-align: left;">
									<h2  style="color: black;margin-bottom: 5px;">
										<#if apply.applyObject??>物品申请：</#if>${apply.title}
											<#list status['apply'] as sa>
												<#if sa.value==apply.status>
													<span class="label" style="background-color: ${sa.color}">${sa.name}</span>
												</#if>
											</#list>
										<#if apply.status==0 && apply.user.id==userinfo.id>
											<a href="/apply/submit/getone?id=${apply.id}" title="修改审批" class="btn btn-update">修改</a>
											<a onclick="deleteFromPage(${apply.id},'/apply/submit/delete')" title="删除审批" class="btn btn-delete">删除</a>
										<#elseif apply.status==2 && apply.user.id==userinfo.id>
											<a href="/apply/submit/getone?id=${apply.id}" title="修改审批" class="btn btn-update">重新申请</a>
										</#if>
									</h2>
								</td>
								<td>申请人：${apply.user.name}</td>
								<td>部门：${apply.user.dept.name}</td>
								<td>当前审核对象：${apply.deptOffice.name}</td>
								<td>发布时间：${apply.time}</td>
							</tr>
						</table>
					</div>
					<div class="info-content">
						<#if apply.applyObject??>
							<h3>物品类型：
								<#list types['apply_object'] as ta>
									<#if ta.value==apply.applyObject.type>
										${ta.name}
									</#if>
								</#list>
							</h3>
							<table id="object">
								<tr>
									<th>物品名称</th>
									<th>物品单位</th>
									<th>物品数量</th>
									<th>备注</th>
								</tr>
								<#assign sum=0 />
								<#list apply.applyObject.applyObjectObject as aoo>
									<tr>
										<td>${aoo.name}</td>
										<td>${aoo.unit}</td>
										<td>${aoo.count}</td>
										<td>${aoo.remark}</td>
									</tr>
									<#assign sum=sum+aoo.count />
								</#list>
								<tr>
									<td></td>
									<td></td>
									<td>总计：${sum}</td>
									<td></td>
								</tr>
							</table>
						<#elseif apply.applyLeave??>
							请假时间：${apply.applyLeave.goTime}-${apply.applyLeave.backTime}<br>
							请假原由：${apply.applyLeave.reason}
						</#if>
						<#if apply.status!=2 && userinfo.deptOffice.id==apply.deptOffice.id>
							<form class="operate">
								<span><input type="radio" name="approval" value="2" >同意并结束该申请</span><br>
								<span><input type="radio" name="approval" value="1">同意并继续选择下一审批对象</span>
									<input id="cc1" class="easyui-combobox" data-options="valueField: 'id',editable:false,textField: 'name',url: '/user/depts/get',onSelect: function(rec){var url = '/user/dept/office/get?id='+rec.id;$('#cc2').combobox('reset');$('#cc2').combobox('reload', url);}">
									<input name="office" id="cc2" class="easyui-combobox" data-options="valueField:'id',textField:'name',editable:false"><br>
								<span><input type="radio" name="approval" value="0">拒绝并退回</span><br>
								<span><input type="text" name="remark" placeholder="留言，不超过30个字符" maxlength="30"></span>
								<input type="hidden" name="applyId" value="${apply.id}">
								<button class="button">审核</button>
							</form>
						</#if>
					</div>
					<div class="info-record">
						<h3 class=""><i class="iconfont icon-circle1"></i>流程开始</h3>
						<div class="shape"></div>
						<#list record as record>
							<div class="record-user">
								<h4>${record.user.deptOffice.name}：${record.user.name}</h4>
								<span>${record.time}</span>
							</div>
							<#if record.user.photo??&&record.user.photo!=''>
		    					<img class="user-head" alt="用户头像" src="/file/image/${record.user.photo}" width="25px" height="25px">
							<#else>
		    					<img class="user-head" alt="用户头像" src="/images/default-head.jpg" width="25px" height="25px">
							</#if>
							<div class="record-content">${record.content}</div>
							<div class="shape"></div>
						</#list>
						<#if apply.status==2>
							<h3><i class="iconfont icon-circle1"></i>流程结束</h3>
						<#else>
							<h3>----${apply.deptOffice.name}正在审核----</h3>
						</#if>
					</div>
				<#else>
					该申请不存在~
				</#if>
			</div>
		</div>

	</div>
</body>
</html>